﻿using _1._8._2015_SHero_Auth.Data;
using _1._8._2015_SHero_Auth.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace _1._8._2015_SHero_Auth.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ApplicationDbContext db = new ApplicationDbContext();
            SHerosViewModel model = new SHerosViewModel();

            model.SHeros = db.SHeros.Select(sh => new SHeroViewModel 
            {
                 Name = sh.Name,
                 Origin = sh.Origin,
                 SuperPower = sh.SuperPower,
                 PowerSource = sh.PowerSource,
                 SHeroId = sh.SHeroId
            }).ToList();

            return View(model);
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}